[Unit]
After={{ openshift.docker.service_name }}.service
Requires={{ openshift.docker.service_name }}.service
PartOf={{ openshift.docker.service_name }}.service

[Service]
ExecStartPre=-/usr/bin/docker rm -f openshift_loadbalancer
ExecStart=/usr/bin/docker run --rm --name openshift_loadbalancer -p {{ openshift_master_api_port | default(8443) }}:{{ openshift_master_api_port | default(8443) }} -v /etc/haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg:ro --entrypoint=haproxy {{ openshift.common.router_image }}:{{ openshift_image_tag }} -f /etc/haproxy/haproxy.cfg
ExecStartPost=/usr/bin/sleep 10
ExecStop=/usr/bin/docker stop openshift_loadbalancer
LimitNOFILE={{ openshift_loadbalancer_limit_nofile | default(100000) }}
LimitCORE=infinity
Restart=always
RestartSec=5s

[Install]
WantedBy={{ openshift.docker.service_name }}.service
